package com.example.spring_java_oj.service.userInfo;

import com.example.spring_java_oj.mapper.UserInfoRedis;
import com.example.spring_java_oj.model.UserInfo;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class UserInfoRedisService {

    @Autowired
    private UserInfoRedis userInfoRedis;

    public UserInfo queryByName(String userName) throws JsonProcessingException {
        return userInfoRedis.getUserInfoByName(userName);
    }

    public UserInfo queryById(Integer userId) throws JsonProcessingException {
        return userInfoRedis.getUserInfoById(userId);
    }

    public void register(UserInfo userInfo) throws JsonProcessingException {
        userInfoRedis.register(userInfo);
    }
}
